import 'dart:developer';

import 'package:dio/dio.dart';

class HttpLogInterceptor extends LogInterceptor {
  HttpLogInterceptor({
    super.responseBody = true,
    super.request = false,
    super.requestBody = true,
    super.requestHeader = false,
    super.responseHeader = false,
    super.logPrint = _debugPrint,
  });

  // @override
  // void onRequest(    RequestOptions options,
  //     RequestInterceptorHandler handler,){
  //   if (requestBody) {
  //     logPrint('data:');
  //     _printAll(options.data);
  //   }
  // }

  //替换默认的日志打印方法，解决日志打印不全的问题
  static void _debugPrint(Object? object) {
    assert(() {
      log(object.toString());
      return true;
    }());
  }
}
